import http from '../utils/http.js'

const CUST_SERV_URL = process.env.CUST_SERV_URL
const PREFIX_REST_PATH = 'api/custcenter/custs'

const custApi = {
  // 添加
  addCust (params, success, error) {
    http.post(CUST_SERV_URL + PREFIX_REST_PATH, {params, success, error})
  },
  // 修改
  updateCust (params, success, error) {
    http.put(CUST_SERV_URL + PREFIX_REST_PATH + '/' + params.custId, {params, success, error})
  },
  // 删除（可多个）
  delCust (params, success, error) {
    http.delete(CUST_SERV_URL + PREFIX_REST_PATH + '/' + params, {params, success, error})
  },
  // 分页查询
  queryCustPage (params, success, error) {
    http.get(CUST_SERV_URL + PREFIX_REST_PATH + '/page', {params, success, error})
  },
  // 列表查询
  queryCusts (params, success, error) {
    http.get(CUST_SERV_URL + PREFIX_REST_PATH, {params, success, error})
  },
  // 单个对象获取
  getCust (params, success, error) {
    http.get(CUST_SERV_URL + PREFIX_REST_PATH + '/' + params.custId, {params, success, error})
  }
}
export default custApi
